﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WeiTuo
{
    internal class Program
    {
        static void Main(string[] args)
        {

            //3创建委托变量
            dou chi = null;

            //4关联委托方法

            chi = add;

            //5使用委托

            Console.WriteLine(chi(15,6).ToString());
            Console.ReadLine();
        }


        //2编写方法，必须是静态方法

        public static int add(int a, int b)
        { 
        int c = a + b;
        return c;
        }


        public static int sub(int a, int b)
        {
            int c = a - b;
            return c;
        }


        public static int mul(int a, int b)
        {
            int c = a*b;
            return c;
        }


        public static int div(int a, int b)
        {
            int c = a/b;
            return c;
        }


    }

    //1声明委托,是与类同级别。
    public delegate int dou(int a, int b);



}
